home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / PGM_TOOL / TPRCDR10 / WHERE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-12-26  |  2KB  |  69 lines

  1. { ╔═══════════╤════════════════════════════════════════════════╗
  2.   ║ Programmer│ Tony Papadimitriou                             ║
  3.   ║ Program   │ WHERE                                          ║
  4.   ║ Uses      │ Dos, TPUtils, TPRecDir                         ║
  5.   ║ Includes  │ Nothing                                        ║
  6.   ║ Links     │ Nothing                                        ║
  7.   ║ Created   │ Sunday, December 19, 1993  2:08 am             ║
  8.   ║ Updated   │ Saturday, December 25, 1993  3:50 pm           ║
  9.   ║ Language  │ (MSDOS) Turbo Pascal 6.0                       ║
  10.   ║ Purpose   │ Show off TPRecDir unit                         ║
  11.   ╟───────────┴┬──────── Version History ──────────────────────╢
  12.   ║ 1.00       │Original                                       ║
  13.   ╚════════════╧═══════════════════════════════════════════════╝ }
  14. uses
  15.   Dos,
  16.   TPUtils,
  17.   TPRecDir;
  18.  
  19. const
  20.   progName = 'WHERE';
  21.   version  = '1.00';
  22.  
  23. procedure Copyright;
  24. begin
  25.   Writeln(stderr);
  26.   Writeln(stderr,progName+' ver. ' + version + ' ■ Copyright (c) 1993-94 by Tony G. Papadimitriou *FREEWARE*');
  27.   Writeln(stderr);
  28. end; { Copyright }
  29.  
  30. var
  31.   totalMatches: Longint;
  32.  
  33. { --- this is the user routine whose address you must supply to ForEachFileIn }
  34. function List(rec: SearchRec): Boolean; far;
  35. begin
  36.   List := True;
  37.   ShowProgressHere;
  38.   if not AttributeMatches(rec.attr,Directory) then
  39.   begin
  40.     Inc(totalMatches);
  41.     BlankLine;
  42.     Writeln(FExpand(rec.name));
  43.     Write(stderr,'Working  ');
  44.   end;
  45. end; { List }
  46.  
  47. var
  48.   path : PathStr;
  49.   mask : String;
  50. begin
  51.   Copyright;
  52.   if ParamCount = 0 then
  53.   begin
  54.     Writeln(stderr,'Usage: WHERE [<path>\]<mask>[;<mask>]');
  55.     Writeln(stderr);
  56.     Writeln(stderr,'       Press ESC during search to interrupt prematurely.');
  57.     Halt;
  58.   end; { if }
  59.   totalMatches := 0;
  60.   path := ParamStr(1);
  61.   mask := GetMask(path);
  62.   path := GetPath(path);
  63.   Write(stderr,'Working  ');
  64.   ForEachFileIn(path,mask,AnyFile,True,True,@List);
  65.   BlankLine;
  66.   if errorsFound then Writeln(stderr,'Errors during processing!');
  67.   Writeln(stderr,totalMatches,' match'+OneManyStr(totalMatches,'','es')+' found!');
  68. end.
  69.